﻿<Window x:Class="SolickManagerV3_4.Windows.AddOrEditSaleWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SolickManagerV3_4.Windows"
        mc:Ignorable="d"
        Icon="Images/SolulCompIcon.ico"
        WindowStartupLocation="CenterScreen"
        Title="SoulComp Manager" Height="700" Width="400">
    <Border Width="350"
            Height="620"
            CornerRadius="10"
            Background="#3993DD"
            Padding="25">
        <StackPanel>
            <TextBlock Foreground="White"
                       Height="25"
                       VerticalAlignment="Top"
                       HorizontalAlignment="Center"
                       FontSize="20"
                       FontFamily="Inter"
                       FontWeight="Medium"
                       Text="Продажа"
                       Margin="0 0 0 15"/>

            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Дата"
                           Foreground="White"
                           FontFamily="Inter"
                           FontSize="16"
                           Height="20"/>
                <TextBox Style="{DynamicResource RoundTextBox}" 
                         Width="155"
                         Margin="10 0"
                         Text="{Binding Data}"/>
                <Button Content="сегодня"
                        Style="{DynamicResource ButtonRoundStyle}"
                        Background="White"
                        Width="85"
                        FontSize="14"
                        FontWeight="Medium"
                        Click="SetToday"/>
            </StackPanel>

            <StackPanel Orientation="Horizontal"
                        Margin="0 10 0 0">
                <TextBlock Text="Клиент"
                           Foreground="White"
                           FontFamily="Inter"
                           FontSize="16"
                           Height="20"/>
                <ComboBox Width="148" 
                          Margin="10 0" 
                          ItemsSource="{Binding Clients}"
                          SelectedItem="{Binding SelectedClient}"/>
                <Button Content="новый"
                        Style="{DynamicResource ButtonRoundStyle}"
                        Background="White"
                        Width="80"
                        FontSize="14"
                        FontWeight="Medium" Click="VisibillityClient"/>
            </StackPanel>
            <Border CornerRadius="5" Background="White" Padding="5" Margin="0 5 0 0" Visibility="Collapsed" x:Name="ClientBorder">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <StackPanel>
                        <Label Height="24" Content="Фамилия" FontFamily="Inter" FontSize="14" FontWeight="Medium" Margin="0 0 0 5"/>
                        <Label Height="24" Content="Имя" FontFamily="Inter" FontSize="14" FontWeight="Medium" Margin="0 0 0 5"/>
                        <Label Height="24" Content="Отчество" FontFamily="Inter" FontSize="14" FontWeight="Medium" Margin="0 0 0 5"/>
                        <Label Height="24" Content="Дата рождения" FontFamily="Inter" FontSize="14" FontWeight="Medium" Margin="0 0 0 5"/>
                        <Label Height="24" Content="Номер телефона" FontFamily="Inter" FontSize="14" FontWeight="Medium" Margin="0 0 0 5"/>

                    </StackPanel>
                    <StackPanel Grid.Column="1">
                        <TextBox Width="auto" Height="24" Margin="0 0 0 5" Text="{Binding SecondName, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBox Width="auto" Height="24" Margin="0 0 0 5" Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBox Width="auto" Height="24" Margin="0 0 0 5" Text="{Binding Patronymic, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBox x:Name="DataTextBox" Width="auto" Height="24" Margin="0 0 0 5" Text="{Binding Birthday, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBox Width="auto" Height="24" Margin="0 0 0 5" Text="{Binding Phone, UpdateSourceTrigger=PropertyChanged}"/>
                    </StackPanel>
                </Grid>
            </Border>
            <Border CornerRadius="10"
                                Background="White"
                                BorderThickness="0"
                                Width="300"
                                MinHeight="120"
                                Padding="5"
                                Margin="0 20 0 0">
                <StackPanel 
                                    Width="290"
                                    MinHeight="110"
                                    Height="auto">
                    <Label  Content="Товары:"
                                        FontSize="14"
                                        Foreground="Black"
                                        FontFamily="Inter/#Inter-V.ttf"/>
                    <ListView x:Name="ProductsListView"
                                          ItemsSource="{Binding OtherFunctons.Products}"
                                          SelectedItem="{Binding SelectedProduct}"
                                          DisplayMemberPath="ProductView"
                                          FontSize="12"
                                          Foreground="Black"
                                          FontFamily="Inter/#Inter-V.ttf"
                                          Width="290"
                                          Height="100"
                                          HorizontalAlignment="Center">
                        <ListView.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Добавить" Click="AddProduct"/>
                                <MenuItem Header="Удалить" Click="DeleteProduct"/>
                            </ContextMenu>
                        </ListView.ContextMenu>
                    </ListView>
                    <ListView x:Name="AssembliesListView"
                                          ItemsSource="{Binding OtherFunctons.Assemblies}"
                                          SelectedItem="{Binding SelectedAssembly}"
                                          DisplayMemberPath="GroupProductsView"
                                          FontSize="12"
                                          Foreground="Black"
                                          FontFamily="Inter/#Inter-V.ttf"
                                          Width="290"
                                          Height="100"
                                          HorizontalAlignment="Center">
                        <ListView.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Добавить" Click="AddAssemblies"/>
                                <MenuItem Header="Удалить" Click="DeleteAssemblies"/>
                            </ContextMenu>
                        </ListView.ContextMenu>
                    </ListView>
                </StackPanel>
            </Border>


            <Button x:Name="SaveButton"
                    Style="{DynamicResource ButtonRoundStyle}"
                    Content="Сохранить"
                    Width="260"
                    Margin="0 10 0 0"
                    Height="35"
                    Background="White"
                    FontSize="20"
                    FontWeight="Medium"
                    FontFamily="Inter"
                    Click="Save"/>
        </StackPanel>
    </Border>
</Window>
